home *** CD-ROM | disk | FTP | other *** search
/ Gigarom 1 / Gigarom Macintosh Archives (Quantum Leap)(CDRM1080320)(1993).iso / FILES / BBS / MUBBS / bbslst11.cpt / BBSList.c < prev    next >
Text File  |  1991-12-31  |  4KB  |  140 lines

  1. /*
  2.  *   BBS List Module - Version 1.0 - By Scott Szretter
  3.  *
  4.  *      (C)1991 Scott Szretter - Please see the file "COPYRITE.SPS"
  5.  *
  6.  *        ))) Version Changes (((
  7.  * --Version-------------Notes-----------------------------------------------------------------
  8.  *    NONE YET......
  9.  *
  10.  *  This program may not be sold for profit!
  11.  *  The source code is being release for educational purposes only.
  12.  *  I take no responsibility for any damage resulting from this code.
  13.  */
  14. #define INMAIN
  15. #include     <SetUpA4.h>
  16. #include    "MUBBS Module.h"
  17.  
  18. pascal void main (mode1,G1,P1)
  19.        int mode1;
  20.        struct GS *G1;
  21.        Ptr *P1;{
  22. Handle temph;
  23. float version = 0.5; /* version of MUBBS */
  24. RememberA0(); SetUpA4(); 
  25. asm { _RecoverHandle }; asm {move.l a0,temph}; HLock(temph); /* lock our module. */
  26. G=G1; 
  27. mode[u]=mode1;
  28.  
  29. switch (mode[u]) {
  30.     case 2:
  31.         BBSList();
  32.         G->moduleresult=0;
  33.         break;
  34.     case 98:
  35.         versionck(version);
  36.         break;        
  37.     case 0:
  38.         strcpy (G->programmer,"Scott Szretter");
  39.         G->moduleresult=0;
  40.         break;
  41.     default:
  42.         G->moduleresult=1;
  43.         break;};
  44. HUnlock(temph); /* unlock module.*/
  45. RestoreA4();}
  46.  
  47. /****        *   *    *    -BBSList-   *   *   *   *          ****/
  48. BBSList()  {
  49. FILE *stream;
  50. char filename[65];
  51. char temp1[23];
  52. char temp2[19];
  53. char temp3[15];
  54. char temp4[14];
  55. char temp5[80];
  56. char datetime[25];
  57. int SMenu,W,itemp;
  58. if (!G->online[u]) return; /* Log out if hang up */
  59. SMenu=TRUE;
  60. W=TRUE;
  61. strcpy(filename,":bbslist:");
  62. strcat(filename,G->modulename[u]);
  63. strcat(filename,".intro");
  64. print("C> Line %d %s, at: %s\n",(u+1),G->username[u],G->modulename[u]);
  65. loguser(G->modulename[u]); /* write to log file */
  66. send (G->CR[u]);
  67. sendtext(filename);
  68. while (W=TRUE) {
  69.     if (!G->online[u]) return;
  70.      if (SMenu=TRUE){
  71.         send("]]  *** BBSList Menu ***      ");
  72.         send (G->CR[u]);
  73.         if (!(cmd1(">> Display, Add, Help, Quit, Logoff "))) G->online[u]=FALSE;
  74.         SMenu=FALSE;  }
  75.         send(G->CR[u]);
  76.             if (G->input[u] =='Q') {
  77.                 W=FALSE;
  78.                 print("C> Exiting BBSList -> ",G->username[u]);
  79.                 send("] Thank You for using BBSList!");
  80.                 return;}
  81.             if (G->input[u] =='L') {
  82.                 W=FALSE;
  83.                 G->online[u]=FALSE;}
  84.             if (G->input[u] =='H') {
  85.                 strcpy(filename,":bbslist:");
  86.                 strcat(filename,G->modulename[u]);
  87.                 strcat(filename,".help");
  88.                 send (G->CR[u]);
  89.                 sendtext(filename);
  90.                 send ("]BBSList 1.0 By - Scott Szretter");
  91.                 SMenu=TRUE;
  92.                 W=TRUE;}
  93.             if (G->input[u] =='D'){
  94.                 strcpy(filename,":bbslist:");
  95.                 strcat(filename,G->modulename[u]);
  96.                 strcat(filename,".info");
  97.                 send (G->CR[u]);
  98.                 sendtext(filename);}
  99.             if (G->input[u] =='A'){
  100.                 send("]Please enter the name of the BBS (20 characters max)");
  101.                 send("] !--------!---------!");
  102.                 send("]>");
  103.                 portsin(temp1, 20);
  104.                 if (temp1[0] == 0){
  105.                     send("]Aborted...");
  106.                     send(G->CR[u]);
  107.                     return;}
  108.                 send("]Please enter the phone number of the BBS (16 characters max)");
  109.                 send("] !--------!-----!");
  110.                 send("]>");
  111.                 portsin(temp2, 16);
  112.                 send("]Please enter the maximum baud of the BBS (12 characters max)");
  113.                 send("] !--------!-!");
  114.                 send("]>");
  115.                 portsin(temp3, 12);
  116.                 send("]Please enter the software type of the BBS (11 characters max)");
  117.                    send("]i.e. - MUBBS, WWIV, HRMS, FIDO, RRH, etc...");
  118.                 send("] !--------!!");
  119.                 send("]>");
  120.                 portsin(temp4, 11);
  121.                 send("]Now, enter a one line (77 char) description of this bbs.");
  122.                 send("] !--------!---------!---------!---------!---------!---------!---------!------!");
  123.                 send("]>");
  124.                 portsin(temp5, 77);
  125.                 send(G->CR[u]);
  126.                     strcpy(filename,":bbslist:");
  127.                     strcat(filename,G->modulename[u]);
  128.                     strcat(filename,".info");
  129.                     if ((stream = fopen(filename, "a")) == NULL) { /* Open the file */
  130.                     send("]FILE ERROR cannot open %s ]", filename);
  131.                     print("\nFile ERROR Cannot Open %s W",filename);
  132.                        return;}
  133.                        gettime("%m/%d/%y",datetime); /* gets the date in m/d/y */
  134.                     if (fprintf(stream,"%-21s %-17s %-13s %-12s %-15s\r %-77s\r",temp1,temp2,temp3,temp4,datetime,temp5)==EOF) print("bad fprintf conversion\n");
  135.                     fclose(stream); 
  136.                     send(G->CR[u]);
  137.                     send("Your entry has been added to the BBSList!");
  138.                     print("C> Added to WishList -> ",G->username[u]);}
  139.                         }
  140.                     }